package com.foreveross.chameleon.exhibition;

import android.content.Intent;
import android.os.Bundle;
import com.foreveross.chameleon.base.BslConfig;
import com.foreveross.chameleon.base.EnableCrossDomain;
import com.foreveross.chameleon.mdm.MdmCmdExecutor;
import com.foreveross.chameleon.utils.AppLog;
import org.apache.cordova.Config;
import org.apache.cordova.CordovaActivity;

public class chameleon extends CordovaActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        super.init();
        EnableCrossDomain.enableContentAsLocal(appView);
        String url = Config.getStartUrl();
        if (!url.startsWith("/")) {
            url = "/" + url;
        }
        url = url.startsWith("/") ? url : "/" + url;
        url = BslConfig.SCHEME_PROVIDER + url;
        //String url = BslConfig.SCHEME_PROVIDER + "/file:///android_asset/www/login/index.html";
        AppLog.i("chameleon, url=" + url);
        super.loadUrl(url);
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        if (requestCode == MdmCmdExecutor.REQUEST_CODE_MDM) {
            if (resultCode == RESULT_OK) {
                AppLog.i("mdm 激活成功");
            } else {
                AppLog.i("mdm 未激活");
            }
        } else {
            super.onActivityResult(requestCode, resultCode, data);
        }
    }
}

